import { Module } from '@nestjs/common';
import { AuthService } from './auth.service';
import { AuthController } from './auth.controller';
import { JwtModule } from '@nestjs/jwt';
import JwtAuthStrategy from 'src/common/jwt-auth.strategy';
import { MailerModule } from '@nestjs-modules/mailer';
import { PugAdapter } from '@nestjs-modules/mailer/dist/adapters/pug.adapter';

@Module({
  imports: [MailerModule.forRoot({
    transport: {
      host: 'smtp.126.com',
      port: 25,
      ignoreTLS: true,
      secure: false,
      auth: {
        user: '',
        pass: '',
      },
    },
    defaults: {
      from: '"名字" <你的邮箱地址>',
    },
    preview: false,
    template: {
      dir: process.cwd() + '/template/',
      adapter: new PugAdapter(), // or new PugAdapter() or new EjsAdapter()
      options: {
        strict: true,
      },
    },
  }),JwtModule.register({
    secret: 'water',
    signOptions: {
      expiresIn: '7d'
    }
  })],
  controllers: [AuthController],
  providers: [AuthService, JwtAuthStrategy],
})
export class AuthModule {}
